gh-145335: Fix os functions when passing fd -1 as path - #145439
Conversation
os.listdir(-1) and os.scandir(-1) now fail with OSError(errno.EBADF) rather than listing the current directory. os.listxattr(-1) now fails with OSError(errno.EBADF) rather than listing extended attributes of the current directory.
commented
Mar 2, 2026
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit a894262 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F145439%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
commented
Mar 3, 2026
|
Tests failed on 5 buildbots, but failures are unrelated to this change.
3 tests failed: |
Inline check_for_ebadf().
commented
Mar 3, 2026
|
Merged. Thanks for the review! |
commented
Mar 3, 2026
I had a look and I didn't find other places with the same bug.
|
commented
Mar 5, 2026
|
This appears to have broken Emscripten builds; not sure if the fix is a test skip, or if there's some additional handling required. /cc @hoodmane |
commented
Mar 5, 2026
|
I'll look into it, thanks for the ping @freakboy3742. |
commented
Mar 5, 2026
|
Problem seems to be that on Emscripten |
commented
Mar 5, 2026
|
Fix here: #145528 |
commented
Mar 5, 2026
Oh, I missed this buildbot failure since it's still classified as Unstable. I propose to promote it to Stable: python/buildmaster-config#678. |
os.listdir(-1) and os.scandir(-1) now fail with OSError(errno.EBADF) rather than listing the current directory.
os.listxattr(-1) now fails with OSError(errno.EBADF) rather than listing extended attributes of the current directory.
os.pathconf(-1, 1)#145335